package com.jsh.test.controller;

import com.jsh.annotation.MyLog;
import com.jsh.result.Result;
import com.jsh.test.entity.User;
import com.jsh.test.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author: jsh
 * @create: 2023/5/4 23:30
 * @Description:
 * @FileName: UserController
 * @History:
 * @自定义内容：
 */
@RestController
public class UserController {

    @Autowired
    private UserMapper userMapper;

    @MyLog("获取用户列表信息")
    @GetMapping("/user")
    public Result query(String name){
        System.out.println(name);
        List<User> users = userMapper.selectList(null);
        Result success = Result.success(1800, "查询成功！", users);
        System.out.println(success);
        return success;
    }


    @MyLog("user1")
    @GetMapping("/user1")
    public String string(){
        System.out.println("/user");
        //List<User> users = userMapper.selectList(null);
        return "ok";
    }

    @GetMapping("/ttt")
    public User getUser(){
        User user = new User(12l, "name", 11, "eee");
        return user;
    }
}
